
/**
------------------------------------------------------------
* NGUYEN SY BACH
* bit.mta@gmail.com
* Hoc Vien Ky Thuat Quan Su
------------------------------------------------------------
*** Test thu nghiem voi OpenCV
------------------------------------------------------------
*/

#pragma once

#include "opencv2\core\core.hpp"
#include "opencv2\highgui\highgui.hpp"
#include "nsb_helper.h"
#include "nsb_functions.h"
extern
int test(char *filename);

extern int testWithOpenCV(int argc, char *argv[])
{
	test(argv[1]);
	return 0;
	if (argc <= 1)
		return 1;
	
	cv::Mat img = cv::imread(argv[1], CV_LOAD_IMAGE_COLOR);
	HANDLE_NULL(img.data);
	cv::namedWindow(argv[1]);
	cv::imshow(argv[1], img);
	// doc tham so ham f
	double f[6];
	for (int i = 0; i < 6; ++i)
		f[i] = atof(argv[2 + i]);
	double g[6];
	Inv(f, g);
	double minx, miny, maxx, maxy;
	GetBox(0, 0, img.rows, img.cols, f, minx, miny, maxx, maxy);
	printf("%0.2f %0.2f\n%0.2f %0.2f\n", minx, miny, maxx, maxy);
	int width_out = (int)(ceil(maxx) - floor(minx));
	int height_out = (int)(ceil(maxy) - floor(miny));
	cv::Mat img_out(height_out, width_out, CV_8UC3);
	HANDLE_NULL(img_out.data);

	cv::waitKey(0);
	cv::destroyAllWindows();
	return 0;
}